/* ======================================================
   PREMIUM STOPWATCH TIMER
   ====================================================== */

:root {
  --stopwatch-color-primary: #9333ea;
  --stopwatch-color-secondary: #7c3aed;
  
  --accent-green: #10b981;
  --accent-dark-green: #059669;
  --accent-orange: #f59e0b;
  --accent-dark-orange: #d97706;
  --accent-blue: #3b82f6;
  --accent-dark-blue: #2563eb;
  --accent-red: #ef4444;
  --accent-dark-red: #dc2626;
}

.stopwatch-card-content {
  max-width: 100%;
  margin: 0 auto;
  padding: 35px;
  background: linear-gradient(145deg, var(--card-bg) 0%, var(--secondary-bg) 100%);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.05) inset;
  color: var(--text-color);
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

.stopwatch-card-content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-purple), var(--accent-blue), var(--accent-purple));
  background-size: 200% 100%;
  animation: stopwatchGradientShift 3s ease infinite;
}

@keyframes stopwatchGradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.stopwatch-card-content h1 {
  color: var(--text-primary);
  font-size: 2rem;
  margin-bottom: 8px;
  text-align: center;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.stopwatch-intro {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 30px;
  line-height: 1.6;
  font-weight: 400;
}

/* Main Layout */
.stopwatch-main-layout {
  display: flex;
  gap: 30px;
}

.stopwatch-left-column {
  flex: 1;
  min-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.stopwatch-right-column {
  flex: 1.5;
  min-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Timer Display */
.stopwatch-display-container {
  background: var(--overlay-dark);
  border: 2px solid var(--border-dark);
  border-radius: 15px;
  padding: 30px 20px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.stopwatch-display-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--stopwatch-color-primary), var(--stopwatch-color-secondary));
  background-size: 200% 100%;
  animation: displayShimmer 3s ease infinite;
}

@keyframes displayShimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.stopwatch-display {
  font-family: 'Courier New', monospace;
  font-size: 3rem;
  font-weight: 700;
  color: var(--stopwatch-color-primary);
  margin-bottom: 10px;
  text-shadow: 0 0 20px rgba(147, 51, 234, 0.3);
}

.stopwatch-display.running {
  animation: pulse 2s ease-in-out infinite;
}

.stopwatch-display.finished {
  color: var(--accent-green);
  animation: flash 0.5s ease-in-out 3;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

@keyframes flash {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.stopwatch-status {
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Presets */
.stopwatch-presets {
  background: rgba(255, 255, 255, 0.05);
  padding: 20px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  backdrop-filter: blur(10px);
}

.stopwatch-presets label {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.95rem;
  margin-bottom: 12px;
  display: block;
}

.stopwatch-presets-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.stopwatch-preset-btn {
  padding: 10px 5px;
  height: 65px;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid var(--border-dark);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  position: relative;
  overflow: hidden;
}

.stopwatch-preset-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(147, 51, 234, 0.2); 
  transform: translate(-50%, -50%);
  transition: width 0.4s, height 0.4s;
}

.stopwatch-preset-btn:hover::before {
  width: 150px;
  height: 150px;
}

.stopwatch-preset-btn:hover {
  border-color: var(--stopwatch-color-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(147, 51, 234, 0.3);
}

.stopwatch-preset-btn.active {
  border-color: var(--stopwatch-color-primary);
  background: rgba(147, 51, 234, 0.15);
}

/* Control Buttons */
.stopwatch-controls {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.stopwatch-btn {
  padding: 14px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.stopwatch-btn::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
  pointer-events: none;
}

.stopwatch-btn:hover::before {
  width: 450px;
  height: 450px;
}

.stopwatch-btn-start {
  background: linear-gradient(135deg, var(--accent-green) 0%, var(--accent-dark-green) 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

.stopwatch-btn-start:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.6);
}

.stopwatch-btn-pause {
  background: linear-gradient(135deg, var(--accent-orange) 0%, var(--accent-dark-orange) 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4);
}

.stopwatch-btn-pause:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.6);
}

.stopwatch-btn-lap {
  background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-dark-blue) 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.stopwatch-btn-lap:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.6);
}

.stopwatch-btn-reset {
  background: linear-gradient(135deg, var(--accent-red) 0%, var(--accent-dark-red) 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

.stopwatch-btn-reset:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.6);
}

.stopwatch-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* Settings */
.stopwatch-settings {
  background: rgba(255, 255, 255, 0.05);
  padding: 15px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stopwatch-checkbox-option {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.stopwatch-checkbox-option:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--stopwatch-color-primary);
  transform: translateX(4px);
}

.stopwatch-checkbox-option span {
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
}

.stopwatch-option-icon {
  font-size: 1.1rem;
}

.stopwatch-checkbox-option input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--stopwatch-color-primary);
  flex-shrink: 0;
}

/* Statistics */
.stopwatch-stats {
  background: var(--overlay-dark);
  border: 2px solid var(--border-dark);
  border-radius: 12px;
  padding: 20px;
  width: 100%;
  box-sizing: border-box;
}

.stopwatch-stats h3 {
  color: var(--text-primary);
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 15px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
  width: 100%;
}

.stat-item {
  background: rgba(255, 255, 255, 0.05);
  padding: 15px;
  border-radius: 10px;
  border: 2px solid var(--border-dark);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.2s ease;
  box-sizing: border-box;
  min-width: 0;
}

.stat-item:hover {
  border-color: var(--stopwatch-color-primary);
  transform: translateY(-2px);
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.stat-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--stopwatch-color-primary);
  font-family: 'Courier New', monospace;
}

/* Laps Container */
.stopwatch-laps-container {
  background: var(--overlay-dark);
  border: 2px solid var(--border-dark);
  border-radius: 12px;
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.laps-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.laps-header h3 {
  color: var(--text-primary);
  font-size: 1.2rem;
  font-weight: 700;
}

.clear-laps-btn {
  padding: 8px 16px;
  background: linear-gradient(135deg, var(--accent-red) 0%, var(--accent-dark-red) 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.clear-laps-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.stopwatch-laps-list {
  overflow-y: auto;
  max-height: 400px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 5px;
}

.laps-empty-state {
  text-align: center;
  color: #6b7280;
  font-size: 0.95rem;
  padding: 40px 20px;
  line-height: 1.6;
}

.lap-item {
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid var(--border-dark);
  border-radius: 10px;
  padding: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s ease;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.lap-item:hover {
  border-color: var(--stopwatch-color-primary);
  transform: translateX(5px);
}

.lap-item.fastest {
  border-color: var(--accent-green);
  background: rgba(16, 185, 129, 0.1);
}

.lap-item.slowest {
  border-color: var(--accent-red);
  background: rgba(239, 68, 68, 0.1);
}

.lap-number {
  font-weight: 700;
  color: var(--stopwatch-color-primary);
  font-size: 1rem;
}

.lap-times {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.lap-time {
  font-family: 'Courier New', monospace;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.lap-split {
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* Custom Scrollbar */
.stopwatch-laps-list::-webkit-scrollbar {
  width: 8px;
}

.stopwatch-laps-list::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
}

.stopwatch-laps-list::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, var(--stopwatch-color-primary) 0%, var(--stopwatch-color-secondary) 100%);
  border-radius: 10px;
}

.stopwatch-laps-list::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, var(--stopwatch-color-secondary) 0%, #6d28d9 100%);
}

/* Export Button */
.stopwatch-export {
  display: flex;
  justify-content: center;
}

.export-btn {
  background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-dark-blue) 100%);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 14px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.export-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.6);
}

/* Feedback Message */
.stopwatch-feedback-message {
  text-align: center;
  background: linear-gradient(135deg, var(--accent-green) 0%, var(--accent-dark-green) 100%);
  color: white;
  padding: 12px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
  margin-top: 20px;
}

.stopwatch-feedback-message.visible {
  opacity: 1;
  transform: translateY(0);
}

.stopwatch-feedback-message.error {
  background: linear-gradient(135deg, var(--accent-red) 0%, var(--accent-dark-red) 100%);
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.stopwatch-feedback-message.warning {
  background: linear-gradient(135deg, var(--accent-orange) 0%, var(--accent-dark-orange) 100%);
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

/* Responsive Design */
@media (max-width: 1200px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  
  .stat-item {
    padding: 12px;
  }
  
  .stat-label {
    font-size: 0.8rem;
  }
  
  .stat-value {
    font-size: 1.1rem;
  }
  
  .stopwatch-display {
    font-size: 2.5rem;
  }
  
  .stopwatch-display-container {
    padding: 25px 15px;
  }
}

@media (max-width: 1024px) {
  .stopwatch-main-layout {
    flex-direction: column;
    gap: 20px;
  }
  
  .stopwatch-left-column,
  .stopwatch-right-column {
    flex: none;
    min-width: unset;
  }
}

@media (max-width: 768px) {
  .stopwatch-card-content {
    padding: 20px 12px;
    border-radius: 16px;
  }

  .stopwatch-card-content h1 {
    font-size: 1.5rem;
  }

  .stopwatch-intro {
    font-size: 0.88rem;
    margin-bottom: 20px;
  }

  .stopwatch-display {
    font-size: 2rem;
  }

  .stopwatch-presets-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .stopwatch-controls {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(1, 1fr);
  }
}

@media (max-width: 480px) {
  .stopwatch-card-content {
    padding: 16px 10px;
  }

  .stopwatch-card-content h1 {
    font-size: 1.3rem;
  }

  .stopwatch-display {
    font-size: 1.8rem;
  }

  .stopwatch-presets-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}